<script setup lang="ts">

import {dateFormatter} from "@/utils/formatTime";

const state = reactive({
  status:['已处理','未处理','已关闭'],
  searchForm: {
    userId: '',
    nickname: '',
    id: '',
    status: '',
    createTime: ''
  },
  tableData: [
    {
      userId: '1',
      nickname: '张三',
      id: '11',
      status: '已处理',
      operator:'admin',
      createTime: '2021-01-01 00:00:00'
    },
    {
      userId: '2',
      nickname: '李四',
      id: '22',
      status: '未处理',
      operator:'admin',
      createTime: '2021-01-01 00:00:00'
    }
   ],
  queryParams:{
    pageNo: 1,
    pageSize: 10
  },
  total:2
})
</script>

<template>
  <ContentWrap>
    <!-- 搜索工作栏 -->
    <el-form
      class="-mb-15px"
      :model="state.searchForm"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="用户ID" prop="userId">
        <el-input

          placeholder="请输入用户ID"
          clearable
          v-model="state.searchForm.userId"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="用户昵称" prop="nickname">
        <el-input

          placeholder="请输入用户昵称"
          clearable
          v-model="state.searchForm.nickname"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="问题编号" prop="id">
        <el-input

          placeholder="请输入问题编号"
          clearable
          v-model="state.searchForm.id"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select
          v-model="state.searchForm.status"
          placeholder="请选择状态"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="(dict, i) in state.status"
            :key="dict + i"
            :label="dict"
            :value="dict"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="提交时间" prop="createTime">
        <el-date-picker
          v-model="state.searchForm.createTime"
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
          class="!w-240px"
          end-placeholder="结束日期"
          start-placeholder="开始日期"
          type="daterange"
          value-format="YYYY-MM-DD HH:mm:ss"
        />
      </el-form-item>
      <el-form-item class="ml-300px">
        <el-button ><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
        <el-button ><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>


  <ContentWrap>
    <el-table :data="state.tableData">
      <el-table-column align="center" label="问题编号" prop="id" />
      <el-table-column align="center" label="用户ID" prop="userId" show-overflow-tooltip />
      <el-table-column align="center" label="用户昵称" prop="nickname" width="300" />
      <el-table-column align="center" label="状态" prop="status">
        <template #default="scope">
          <ElTag
            style='color: #fff'
            type='primary'
            color='blue'
          >
            {{scope.row.status}}
          </ElTag>
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作账号" prop="operator" />
      <el-table-column
        :formatter="dateFormatter"
        align="center"
        label="提交时间"
        prop="createTime"
        width="180"
      />
      <el-table-column align="center" label="操作">
        <template #default="">
          <el-button
            v-hasPermi="['system:dict:update']"
            link
            type="primary"
          >
            查看问题
          </el-button>
          <el-button
            v-hasPermi="['system:dict:delete']"
            link
            type="danger"

          >
            关闭
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <Pagination
      v-model:limit="state.queryParams.pageSize"
      v-model:page="state.queryParams.pageNo"
      :total="state.total"
    />
  </ContentWrap>
</template>

<style scoped lang="scss">

</style>
